package com.lebang.mapper;

import com.lebang.domain.CencesHundredDownloadRecord;
import com.lebang.domain.DownloadMemberRecord;
import com.lebang.example.DownloadMemberRecordExample;
import com.lebang.model.cences.DownloadMemberFinishRecordCount;
import com.lebang.model.cences.DownloadMemberRecordCount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * DownloadMemberRecordMapper继承基类
 */
@Mapper
public interface DownloadMemberRecordMapper extends MyBatisBaseDao<DownloadMemberRecord, Long, DownloadMemberRecordExample> {

    List<CencesHundredDownloadRecord> selectWaitCount(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    int selectSuccessCount(String memberId);

    List<DownloadMemberRecord> selectTodayRecord(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    List<DownloadMemberFinishRecordCount> countByCategory(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    DownloadMemberRecord selectByOrderId(String orderId);

    List<DownloadMemberRecord> selectNewMemberByTime(LocalDateTime star, LocalDateTime end);

    int selectCountByMemberIdAndCategory(@Param("memberId") String memberId, @Param("category") int category, @Param("sdkKey") String sdkKey);

    DownloadMemberRecord selectByAppNameAndMemberId(@Param("appName") String appName, @Param("memberId") String memberId, @Param("pkgName") String pkgName, @Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    Integer selectByStatusAndSdkKey(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("appStore") String appStore, @Param("sdkKey") String sdkKey, @Param("status") Integer status, @Param("isNewMember") Integer isNewMember);

    List<DownloadMemberRecordCount> countByTime(LocalDateTime star, LocalDateTime end);

    List<CencesHundredDownloadRecord> selectShowCount(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    List<CencesHundredDownloadRecord> getSuccessCount(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    Integer countByInt(@Param("finishNum") int finishNum, @Param("appStore") String appStore, @Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("isNewMember") Integer isNewMember);

    List<DownloadMemberRecord> selectByTime(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    List<CencesHundredDownloadRecord> selectFailCount(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    int selectCountByAppNameAndMemberId(@Param("appName") String appName, @Param("memberId") String memberId, @Param("pkgName") String pkgName, @Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    Integer checkPkgName(@Param("pkgName") String pkgName, @Param("memberId") String memberId);

    int selectByDetailIdAndMemberId(@Param("ids") Long ids, @Param("memberId") String memberId);

    Integer groupByMemberId(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("appStore") String appStore, @Param("sdkKey") String sdkKey, @Param("isNewMember") Integer isNewMember);

    int getByStatus(@Param("rouseDetailId") long rouseDetailId, @Param("status") int status, @Param("sdkKey") String sdkKey);

    int selectSuccessCountByImei(@Param("imei") String imei, @Param("sdkKey") String sdkKey);

    BigDecimal sumByStatusAndSdkKey(LocalDateTime star, LocalDateTime end, String appStore, @Param("sdkKey") String sdkKey);

    Integer countAllFinish(@Param("appStore") String appStore, @Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("isNewMember") Integer isNewMember);

    List<CencesHundredDownloadRecord> selectSuccessMemberCount(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);
}